/*
 * Package il.ac.biu.cs.grossmm.api.data
 * File Subscriber.java
 * 
 * This is a part of presence service framework API. 
 * See javadoc for more information.
 *  
 * Copyright (C) 2006 Grossmann Mark
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
 * MA  02110-1301, USA.
 */



package il.ac.biu.cs.grossmm.api.flow;

import il.ac.biu.cs.grossmm.api.data.Root;
import il.ac.biu.cs.grossmm.api.keys.Key;

public interface Subscriber<N> {
    /**
     * Called when a subscription associated with a given key becomes active.
     * 
     * @param key
     *            the key which identifies the subscription
     * @param node
     *            the root node data node associated with the key
     */
    void activated(Key key, Root<N> node);

    /**
     * Called when a subscription associated with a given key becomes inactive
     * 
     * @param key
     *            the key which identifies the subscription
     * @param status
     *            subscription status
     * @throws NoSuchSubscription 
     */
    void deactivated(Key key, Status status) throws NoSuchSubscription;

    /**
     * Called to notify about change in the data node
     * 
     * @param node
     *            the data node
     * @param inspector
     *            event inspector to inspect the changes occured in the node
     */
    void notify(Root<N> node, NodeEventInspector inspector);
}
